package cn.lei.uicontrols;

import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class AtyUsingProgressDialog extends AppCompatActivity {

    private ProgressDialog mProgressDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aty_using_progress_dialog);

        findViewById(R.id.btnShowProgressDialog).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mProgressDialog = ProgressDialog.show(AtyUsingProgressDialog.this, "DownLoading", "DownLoading,please wait.");
                new Thread() {
                    @Override
                    public void run() {
                        try {
                            Thread.sleep(3000);
                            mProgressDialog.dismiss();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }.start();
            }
        });
    }
}
